﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Net.Mail;
using System.Net;

namespace EhotelSystem.FrontviewWebpage
{
    public partial class FeedBack : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
        {
            if ((txtcontactComment.Text.Length > 20))
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }

        protected void Wizard1_FinishButtonClick(object sender, System.Web.UI.WebControls.WizardNavigationEventArgs e)
        {
            SendMail(txtcontactEmail.Text, txtcontactComment.Text);
        }

        private void SendMail(string from, string body)
        {
            string mailServerName = "SMTP.MyDomain.com";
            MailMessage message = new MailMessage(from, "tue_9_doramon@hotmail.com", "FeedBack", body);
            SmtpClient mailClient = new SmtpClient();
            mailClient.Host = mailServerName;
            mailClient.Send(message);
            message.Dispose();
        }
    }
}
